<%layout("/eova/layout/default_lay.html",{'title' : object.name! + '列表'}){%>
<%
	var tree = menu.config.tree;
%>
<link rel="stylesheet" href="/ui2/src/layui_ext/dtree/dtree.css">
<link rel="stylesheet" href="/ui2/src/layui_ext/dtree/font/dtreefont.css">
<body class="childrenBody">


	<!-- 	查询条件,系统配置的搜索条件（还会出现一个默认的过滤条件优先且需要隐藏（主要是跳转过来的数据）） -->
	<%if(isTrue(isQuery!)){%>
<!-- 	<blockquote class="layui-elem-quote quoteBox"> -->
	<#query_lay id="queryForm" objectCode="${object.code}" object="${object}"  />
<!-- 	</blockquote> -->
	
<!-- 	<blockquote class="layui-elem-quote quoteBox"> -->
<!-- 		<form class="layui-form"> -->
<!-- 			<div class="layui-inline"> -->
<!-- 				<div class="layui-input-inline"> -->
<!-- 					<input type="text" class="layui-input searchVal" placeholder="请输入搜索的内容" /> -->
<!-- 				</div> -->
<!-- 				<a class="layui-btn search_btn" data-type="reload">搜索</a> -->
<!-- 			</div> -->
<!-- 			<div class="layui-inline"> -->
<!-- 				<a class="layui-btn layui-btn-normal addNews_btn">添加用户</a> -->
<!-- 			</div> -->
<!-- 			<div class="layui-inline"> -->
<!-- 				<a class="layui-btn layui-btn-danger layui-btn-normal delAll_btn">批量删除</a> -->
<!-- 			</div> -->
<!-- 		</form> -->
<!-- 	</blockquote> -->
	<%}%>
	
	

	


 <div class="layui-row layui-col-space10">
 
    <div class="layui-col-md2">
    <blockquote class="layui-elem-quote layui-quote-nm">
                <#tree_lay id="master_tree" menuCode="${menu.code}" objectCode="${tree.objectCode}" idKey="${tree.idField}" nameKey="${tree.treeField}" pidKey="${tree.parentField}" iconKey="${tree.iconField!}" rootPid="${tree.rootPid}" expandAll="true" />
    

 </blockquote>
    </div>
    <div class="layui-col-md10">
		<!-- 	功能按钮 -->
		<div class="layui-btn-group">
	
		 <%include("/eova/template/treetogrid/btn/query_lay.html",{'queryId':'queryForm', 'parentId':'gridTable'}){}%>
			
		   <%for(btn in btnList){
	 		 try{%>
			 <%include(btn.ui,{'menu': menu, 'object':object, 'button': btn, 'gridId': 'grid','queryId':'queryForm'}){}%>
		  <%}catch(error){%>
		  <script type="text/javascript">
		  layui.use(['layer'], function(){ layer.alert("按钮 '${btn.name}' 未能加载,请联系管理员.", {icon: 2});});
		  </script>
		  <%}}%>
		  
		  							<%// 仅超级管理员可见%>
	        						<%if(session.user.isAdmin){%>
	        						<%include("/eova/button/btn/quick_lay.html",{'menu': menu, 'object':object, 'queryId':'queryForm', 'parentId': 'grid'}){}%>
									<%include("/eova/button/btn/quick_objectFieldAuth_lay.html",{'menu': menu, 'object':object, 'queryId':'queryForm', 'parentId': 'grid'}){}%>
									<%}%>
		  
		  
		</div>
	  
	  	<#grid_lay id="grid" objectCode="${menu.config.objectCode}" toolbar="gridToolbar" menuCode="${menu.code}" isFirstLoad="false"/>
    </div>
   
  </div>

  
  
	


<!-- <script type="text/javascript" src="../../ui2/js/dataList.js"></script> -->
</body>
<script>
// Tree Node OnClick
var nodeClick = function(e, treeId, node) {
	if (!node.isParent) {
		var code = node.${tree.objectField};
		　$('#grid').datagrid('unselectAll');//取消任何选中
		// 按Tree选中节点来初始化显示Grid内容
        $('#grid').datagrid('load',{
            'query_${menu.config.objectField}': code
        });
	}
};



function treedataDone(){
	var	dtree = layui.dtree;
	
	dtree.on("node('master_tree')" ,function(param){
		  //layer.msg(JSON.stringify(param));
		  //console.log(param);
		  var isLeaf = param.isLeaf;
		  var nodeId = param.nodeId;
		 // if(isLeaf)
		  	reload();
		});
}
</script>
<script type="text/javascript" src="${STATIC!}/ui/js/template.js"></script>
<%if(!isEmpty(menu.diy_js!)){%>
<script type="text/javascript" src="${menu.diy_js}"></script>
<%}%>
<%}%>
